package com.example.xiaomi.controller;

import com.example.xiaomi.entity.Useranalysis;
import com.example.xiaomi.entity.contents;
import com.example.xiaomi.service.TopicService;
import com.example.xiaomi.service.UseranalysisService;
import org.apache.catalina.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("useranalysis")
@CrossOrigin
public class UseranalysisController {
    @Autowired
    private UseranalysisService service;

    /**
     * 提取每日用户帖子量作为用户活跃度：http://localhost:8080/useranalysis/active
     * @return
     */
    @GetMapping("active")
    public List<Useranalysis> findAllactive(){
        return service.findAllactive();
    }

    /**
     * 查询用户情感分析数据：http://localhost:8080/useranalysis/analysis
     * @return
     */
    @GetMapping("analysis")
    public List<Useranalysis> findSentiment(){
        return service.findSentiment();
    }

    /**
     * 查询情感关键词词频：http://localhost:8080/useranalysis/words
     * @return
     */
    @GetMapping("words")
    public List<Useranalysis> findSentimentwords(){return service.findSentimentwords();}

    /**
     * 获取ip信息：http://localhost:8080/useranalysis/ip
     * @return
     */
    @GetMapping("ip")
    public List<Useranalysis> findAllip(){
        List<Useranalysis> ipdata = service.findAllip();
        return ipdata;}

    /**
     * 查询获取用户标签：http://localhost:8080/useranalysis/label
     * @return
     */
    @GetMapping("label")
    public List<Useranalysis> findLabel(){return service.findLabel();}

    /**
     * 查询性别分布：http://localhost:8080/useranalysis/gender
     * @return
     */
    @GetMapping("gender")
    public List<Useranalysis> findGender(){return service.findGender();}

    /**
     * 查询年龄分布：http://localhost:8080/useranalysis/age
     * @return
     */
    @GetMapping("age")
    public List<Useranalysis>findAge(){return service.findAge();}
}
